Calendar All Tests
Current file: /home/estudydev/workspace/eStudy_svn/web/ressourcen/classes/filemanager/class.file.inc.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 26
0.00 %0.00%
0.00% 0 / 462
 
File
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 26
0.00 %0.00%
0.00% 0 / 462
 public function setOrigFileName($origFileName)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function getOrigFileName()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function setType($type)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function getType()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function getSize()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function setSize($size)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function setCounter($counter)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function setExtension($extension)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function getExtension()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function getPathToFile()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 4
 public function isFileVisible()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 17
 private function getUserIcons()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 58
 protected function getContent($url)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 10
 private function getFaviconUrl($url)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 14
 private function remoteFileExists($url)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 28
 public function getHTMLString($statisticView = false, $cssClass = '')
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 108
 public function getFileOptionHTML($option)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 10
 private function getCopyFileHTML()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 22
 private function getFileLink()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 16
 private function getStatisticLink()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 14
 private function getDownloadCount()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 13
 private function getDownloadStatisticHTML()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 9
 private function getDeleteFileHTML()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 6
 private function getDescriptionHTML()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 3
 private function getStatisticHTML()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 114
 public function archiverAccept(ResourceVisitor $visitor, $parentPath = '/')
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2


       1                 : <?php                                                                                                                      
       2                 : /*--------------------------------------------------------------------------+                                              
       3                 : This file is part of eStudy.                                                                                               
       4                 : ressourcen/classes/filemanager/class.file.inc.php                                                                          
       5                 : - Modulgruppe:  File Manager                                                                                               
       6                 : - Beschreibung: Klasse "File"                                                                                              
       7                 : - Version:      0.4, 08.01.08                                                                                              
       8                 : - Autor(en):    Tobias Wild <tobias.wild@mni.fh-giessen.de>                                                                
       9                 : +---------------------------------------------------------------------------+                                              
      10                 : This program is free software; you can redistribute it and/or                                                              
      11                 : modify it under the terms of the GNU General Public License                                                                
      12                 : as published by the Free Software Foundation; either version 2                                                             
      13                 : of the License, or any later version.                                                                                      
      14                 : +---------------------------------------------------------------------------+                                              
      15                 : This program is distributed in the hope that it will be useful,                                                            
      16                 : but WITHOUT ANY WARRANTY; without even the implied warranty of                                                             
      17                 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                                              
      18                 : GNU General Public License for more details.                                                                               
      19                 : You should have received a copy of the GNU General Public License                                                          
      20                 : along with this program; if not, write to the Free Software                                                                
      21                 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                                                
      22                 : +--------------------------------------------------------------------------*/                                              
      23                 :                                                                                                                            
      24                 : if (!defined("PATH_TO_ROOT")) {                                                                                            
      25                 :     define("PATH_TO_ROOT", "../../../");                                                                                   
      26                 : }                                                                                                                          
      27                 :                                                                                                                            
      28                 : require_once (PATH_TO_ROOT."ressourcen/classes/filemanager/class.resource.inc.php");                                       
      29                 : require_once (PATH_TO_ROOT."ressourcen/classes/archiver/interface.resourcevisitor.inc.php");                               
      30                 : require_once (PATH_TO_ROOT."user/classes/class.usertools.inc.php");                                                        
      31                 : //                                                                                                                         
      32                 : class File extends Resource {                                                                                              
      33                 :     protected $origFileName;                                                                                               
      34                 :     protected $type;                                                                                                       
      35                 :     protected $size;                                                                                                       
      36                 :     protected $counter;                                                                                                    
      37                 :     protected $extension;                                                                                                  
      38                 :                                                                                                                            
      39                 :     public function setOrigFileName ($origFileName) {                                                                      
      40               0 :         $this->origFileName = $origFileName;                                                                               
      41               0 :     }                                                                                                                      
      42                 :                                                                                                                            
      43                 :     public function getOrigFileName() {                                                                                    
      44               0 :         return $this->origFileName;                                                                                        
      45                 :     }                                                                                                                      
      46                 :                                                                                                                            
      47                 :     public function setType ($type) {                                                                                      
      48               0 :         $this->type = $type ;                                                                                              
      49               0 :     }                                                                                                                      
      50                 :                                                                                                                            
      51                 :     public function getType() {                                                                                            
      52               0 :         return $this->type;                                                                                                
      53                 :     }                                                                                                                      
      54                 :                                                                                                                            
      55                 :     public function getSize() {                                                                                            
      56               0 :         return $this->size;                                                                                                
      57                 :     }                                                                                                                      
      58                 :                                                                                                                            
      59                 :     public function setSize ($size) {                                                                                      
      60               0 :         $this->size = $size;                                                                                               
      61               0 :     }                                                                                                                      
      62                 :                                                                                                                            
      63                 :     public function setCounter ($counter) {                                                                                
      64               0 :         $this->counter = $counter ;                                                                                        
      65               0 :     }                                                                                                                      
      66                 :                                                                                                                            
      67                 :     public function setExtension ($extension) {                                                                            
      68               0 :         $this->extension = $extension ;                                                                                    
      69               0 :     }                                                                                                                      
      70                 :                                                                                                                            
      71                 :     /**                                                                                                                    
      72                 :      * Getter for File extension property.                                                                                 
      73                 :      *                                                                                                                     
      74                 :      * @return String Extenstion                                                                                           
      75                 :      */                                                                                                                    
      76                 :     public function getExtension () {                                                                                      
      77               0 :         return $this->extension;                                                                                           
      78                 :     }                                                                                                                      
      79                 :                                                                                                                            
      80                 :     public function getPathToFile() {                                                                                      
      81               0 :         global $settings;                                                                                                  
      82                 :         // Verzeichnis dass die hochgeladenen Dateien enthält                                                             
      83               0 :         $basedir = PATH_TO_ROOT.$settings["upload_path"].'filemanager/courseID/'.$this->courseID;                          
      84                 :         //die datei wie sie auf dem server liegt (der dateiname ist verschlüsselt)                                        
      85               0 :         $filename = sprintf("%s/%s", $basedir, $this->link);                                                               
      86               0 :         return $filename;                                                                                                  
      87                 :     }                                                                                                                      
      88                 :                                                                                                                            
      89                 :     public function isFileVisible() {                                                                                      
      90               0 :         global $db;                                                                                                        
      91               0 :         if (($_SESSION['usergroup'] == STUDENT ||                                                                          
      92               0 :             $_SESSION['usergroup'] == ALUMNUS ||                                                                           
      93               0 :             $_SESSION['usergroup'] == SCHUELER ||                                                                          
      94               0 :             $_SESSION['usergroup'] == GAST) && $this->visibleType != 1 &&                                                  
      95               0 :             $_SESSION['userid'] != $this->userID) {                                                                        
      96                 :             // Wenn Tutor oder Student und darf nicht sehen spezielle DB abfragen                                          
      97               0 :             if (!isset($_SESSION["assistent"]) ||                                                                          
      98               0 :                 (isset($_SESSION["assistent"]) &&                                                                          
      99               0 :                 $this->visibleType == 3 &&                                                                                 
     100               0 :                 $_SESSION['userid'] != $this->userID)) {                                                                   
     101               0 :                     $visible = $db->get_var(                                                                               
     102                 :                     "SELECT count(*) FROM filevisible WHERE userID='".                                                     
     103               0 :                     Data::toMysql($_SESSION['userid'])."' AND fileID='".                                                   
     104               0 :                     Data::toMysql($this->fileID)."'"                                                                       
     105               0 :                     );                                                                                                     
     106               0 :                     return ($visible >= 1);                                                                                
     107                 :             }                                                                                                              
     108               0 :         }                                                                                                                  
     109               0 :         return true;                                                                                                       
     110                 :     }                                                                                                                      
     111                 :                                                                                                                            
     112                 :     private function getUserIcons() {                                                                                      
     113               0 :         global $visibleIcons;                                                                                              
     114               0 :         $imgFolder = $this->fileManager->getImgFolder();                                                                   
     115                 :         //Performance-Tuning: Image wird ab jetzt als CSS-Sprite geladen!                                                  
     116               0 :         if(isset($_SESSION["UserStyle"]) && $_SESSION["UserStyle"] != "fh_yaml")                                           
     117               0 :             $edit = "<img src='".$imgFolder."edittypes/lock_edit.gif' alt='edit Symbol' />";                               
     118                 :         else $edit = "<img src='".                                                                                         
     119               0 :                 PATH_TO_ROOT."images/transparent.gif' class='icon_lock_edit' alt='edit Symbol' />";                        
     120                 :         //Performance-Tuning: Image wird ab jetzt als CSS-Sprite geladen!                                                  
     121               0 :         if(isset($_SESSION["UserStyle"]) && $_SESSION["UserStyle"] != "fh_yaml")                                           
     122               0 :             $delete = "<img src='".$imgFolder.                                                                             
     123               0 :                         "edittypes/lock_delete.gif' alt='delete Symbol' />";                                               
     124               0 :         else $delete = "<img src='".PATH_TO_ROOT.                                                                          
     125               0 :             "images/transparent.gif' class='icon_lock_delete' alt='delete Symbol' />";                                     
     126               0 :         $fileVisible = "";                                                                                                 
     127               0 :         if ($_SESSION['userid'] == $this->userID ||                                                                        
     128               0 :             $_SESSION['usergroup'] == ADMIN ||                                                                             
     129               0 :             ($_SESSION["usergroup"] == DOZENT &&                                                                           
     130               0 :             $_SESSION["course"] > 0)) {                                                                                    
     131                 :             //Performance-Tuning: Image wird ab jetzt als CSS-Sprite geladen!                                              
     132               0 :             if(isset($_SESSION["UserStyle"]) &&                                                                            
     133               0 :                 $_SESSION["UserStyle"] != "fh_yaml")                                                                       
     134               0 :                 $edit = "<a title='Dateieigenschaften ver&auml;ndern' href='./edit.php?editID=".                           
     135               0 :                     $this->fileID."'><img src='".$imgFolder."edittypes/edit.gif' alt='edit Symbol' /></a>";                
     136                 :             else $edit = "<a title='Dateieigenschaften ver&auml;ndern' href='./edit.php?editID=".                          
     137               0 :                 $this->fileID."'><img src='".PATH_TO_ROOT.                                                                 
     138               0 :                 "images/transparent.gif' class='icon_edit_file' alt='edit Symbol' /></a>";                                 
     139                 :                                                                                                                            
     140                 :             //Performance-Tuning: Image wird ab jetzt als CSS-Sprite geladen!                                              
     141               0 :             if(isset($_SESSION["UserStyle"]) &&                                                                            
     142               0 :                 $_SESSION["UserStyle"] != "fh_yaml")                                                                       
     143               0 :                 $delete = "<a title='Datei l&ouml;schen' href='".                                                          
     144               0 :                         $this->createLink(1, array('action' => "deleteFile", "actionID" => $this->fileID)) .               
     145               0 :                         "'><img src='".$imgFolder."edittypes/delete.gif' alt='delete Symbol' /></a>";                      
     146                 :             else $delete = "<a title='Datei l&ouml;schen' href='".                                                         
     147               0 :                 $this->createLink(1, array('action' => "deleteFile", "actionID" => $this->fileID)) .                       
     148               0 :                 "'><img src='".PATH_TO_ROOT."images/transparent.gif' class='icon_delete_file' alt='delete Symbol' /></a>"; 
     149                 :             //Sichtbarkeitsanzeige für untergeordnete Dateien und Links setzen                                            
     150               0 :             $visibleIcon = "";                                                                                             
     151                 :             //beim Laden der Seite                                                                                         
     152               0 :             if (isset($this->visibleType)&&                                                                                
     153               0 :                 $this->visibleType >= 1 &&                                                                                 
     154               0 :                 $this->visibleType <= 3) {                                                                                 
     155               0 :                 $visibleIcon = $visibleIcons[$this->visibleType];                                                          
     156               0 :             }                                                                                                              
     157                 :             $fileVisible = "<a title='Sichtbarkeit &auml;ndern' href='".                                                   
     158               0 :                     $this->createLink(                                                                                     
     159               0 :                         1, array('action' => "setRessourceVisibility",                                                     
     160               0 :                         "actionID" => $this->fileID)                                                                       
     161               0 :                     )                                                                                                      
     162               0 :                     ."'>".$visibleIcon."</a>";                                                                             
     163               0 :         }                                                                                                                  
     164               0 :         $copyFile = "";                                                                                                    
     165                 :         //Performance-Tuning: Image wird ab jetzt als CSS-Sprite geladen!                                                  
     166               0 :         if(isset($_SESSION["UserStyle"]) && $_SESSION["UserStyle"] != "fh_yaml")                                           
     167               0 :             if ($this->type == "file") $copyFile = "<a title='Datei in anderen Kurs kopieren' href='".                     
     168               0 :             $this->createLink(1, array('action' => "copyFile", "actionID" => $this->fileID)) .                             
     169               0 :             "'><img src='".$imgFolder."edittypes/copy.png' alt='copy Symbol' /></a>";                                      
     170               0 :         else if ($this->type == "file") $copyFile = "<a title='Datei in anderen Kurs kopieren' href='".                    
     171               0 :         $this->createLink(                                                                                                 
     172               0 :             1, array('action' => "copyFile", "actionID" => $this->fileID)                                                  
     173               0 :             ).                                                                                                             
     174               0 :         "'><img src='".PATH_TO_ROOT."images/transparent.gif' class='icon_copy_file' alt='copy Symbol' /></a>";             
     175                 :         //Performance-Tuning: Image wird ab jetzt als CSS-Sprite geladen!                                                  
     176               0 :         if(isset($_SESSION["UserStyle"]) && $_SESSION["UserStyle"] != "fh_yaml")                                           
     177               0 :             return "<a title='Dateibeschreibung anzeigen' href='".                                                         
     178               0 :                     $this->createLink(1, array('action' => "infoFile", "actionID" => $this->fileID)) .                     
     179               0 :                     "'><img src='".$imgFolder."edittypes/info.gif' alt='info Symbol' /></a>".                              
     180               0 :                     $edit.$fileVisible.$delete.$copyFile;                                                                  
     181                 :         else return "<a title='Dateibeschreibung anzeigen' href='".                                                        
     182               0 :                     $this->createLink(1, array('action' => "infoFile", "actionID" => $this->fileID)) .                     
     183               0 :                     "'><img src='".PATH_TO_ROOT."images/transparent.gif' class='icon_info_file' alt='info Symbol' /></a>". 
     184               0 :                     $edit.$fileVisible.$delete.$copyFile;                                                                  
     185                 :     }                                                                                                                      
     186                 :                                                                                                                            
     187                 :                                                                                                                            
     188                 :     protected function getContent($url) {                                                                                  
     189               0 :         $session = curl_init();                                                                                            
     190               0 :         curl_setopt($session, CURLOPT_URL, $url);                                                                          
     191               0 :         curl_setopt($session, CURLOPT_HEADER, false);                                                                      
     192               0 :         curl_setopt($session, CURLOPT_RETURNTRANSFER, true);                                                               
     193               0 :         curl_setopt($session, CURLOPT_CONNECTTIMEOUT, 6);                                                                  
     194               0 :         curl_setopt($session, CURLOPT_TIMEOUT, 6);                                                                         
     195                 :                                                                                                                            
     196               0 :         $response = curl_exec($session);                                                                                   
     197               0 :         if (curl_errno($session)!=0) $response = null;                                                                     
     198                 :                                                                                                                            
     199               0 :         curl_close($session);                                                                                              
     200               0 :         return $response;                                                                                                  
     201                 :     }                                                                                                                      
     202                 :                                                                                                                            
     203                 :                                                                                                                            
     204                 :                                                                                                                            
     205                 :     /**                                                                                                                    
     206                 :      * Ermittelt den Pfad für das Favicon einer Webseite                                                                  
     207                 :      *                                                                                                                     
     208                 :      * @param string [$url] Die Adresse wo das Favicon gesucht werden soll                                                 
     209                 :      * @return string FaviconUrl                                                                                           
     210                 :      * @access public                                                                                                      
     211                 :      */                                                                                                                    
     212                 :     private function getFaviconUrl($url) {                                                                                 
     213               0 :         if (strstr($url, "ftp://")) return false;                                                                          
     214                 :         // Bei https-Links nur im http-Pendant suchen,                                                                     
     215                 :         //da sonst eventuell Zertifikatsmeldungen angezeigt werden                                                         
     216               0 :         $url = str_replace("https://", "http://", $url);                                                                   
     217               0 :         $file = $this->getContent($url);                                                                                   
     218               0 :         if (is_null($file)) return false;                                                                                  
     219               0 :         $lines = explode("\n", $file);                                                                                     
     220               0 :         $tag = $rt = $return = array();                                                                                    
     221               0 :         foreach ($lines as $line) {                                                                                        
     222                 :             /* This only works if the title and its tags are on one line */                                                
     223               0 :             if (eregi("<link(.*)>", $line, $tag))                                                                          
     224               0 :             if (eregi(".*rel=\"SHORTCUT ICON\" (.*)", $tag[1], $rt) ||                                                     
     225               0 :             eregi(".*rel=\"icon\" (.*)", $tag[1], $rt))                                                                    
     226               0 :             if (eregi(".*href=\"([^=]*)\"", $rt[1], $return)) break;                                                       
     227               0 :         }                                                                                                                  
     228                 :                                                                                                                            
     229               0 :         if (isset($return[1])) return $return[1];                                                                          
     230               0 :         return false;                                                                                                      
     231                 :     }                                                                                                                      
     232                 :                                                                                                                            
     233                 :     private function remoteFileExists($url) {                                                                              
     234               0 :         $urlP = parse_url($url);                                                                                           
     235               0 :         if (isset($urlP["host"])) {                                                                                        
     236               0 :             $host = $urlP["host"];                                                                                         
     237               0 :         } else {                                                                                                           
     238               0 :             return false;                                                                                                  
     239                 :         }                                                                                                                  
     240               0 :         $errno = 0;                                                                                                        
     241               0 :         $errstr = "";                                                                                                      
     242               0 :         $fp = @fsockopen($host, 80, $errno, $errstr, 5);                                                                   
     243               0 :         if (!$fp) {                                                                                                        
     244               0 :             return false;                                                                                                  
     245                 :         } else {                                                                                                           
     246               0 :             fputs($fp, "HEAD ".$url." HTTP/1.1\r\n");                                                                      
     247               0 :             fputs($fp, "HOST: ".$host."\r\n");                                                                             
     248               0 :             fputs($fp, "Connection: close\r\n\r\n");                                                                       
     249               0 :             $headers = "";                                                                                                 
     250               0 :             while (!feof($fp)) {                                                                                           
     251               0 :                 $headers.= fgets($fp, 128);                                                                                
     252               0 :             }                                                                                                              
     253                 :         }                                                                                                                  
     254               0 :         fclose($fp);                                                                                                       
     255               0 :         $arrHeaders = explode("\n", $headers);                                                                             
     256               0 :         if (isset($arrHeaders[0])) {                                                                                       
     257               0 :             if (!substr_count($arrHeaders[0], "200 OK")) return false;                                                     
     258               0 :             foreach($arrHeaders as $header) {                                                                              
     259               0 :                 $header = strtoupper($header);                                                                             
     260               0 :                 if (substr_count($header, "CONTENT-TYPE:") &&                                                              
     261               0 :                     substr_count($header, "TEXT/HTML")) return false;                                                      
     262               0 :             }                                                                                                              
     263               0 :             return true;                                                                                                   
     264                 :         }                                                                                                                  
     265               0 :         return false;                                                                                                      
     266                 :     }                                                                                                                      
     267                 :                                                                                                                            
     268                 :     public function getHTMLString($statisticView = false, $cssClass = "") {                                                
     269               0 :         $templateTableRow = ($statisticView) ?                                                                             
     270               0 :             new Template(PATH_TO_ROOT . "/ressourcen/templates/filelist_entry_statistic.html")                             
     271               0 :             : new Template(PATH_TO_ROOT . "/ressourcen/templates/filelist_entry.html");                                    
     272                 :                                                                                                                            
     273               0 :         $activeFolder = $this->fileManager->getActiveFolder();                                                             
     274               0 :         $action = $this->fileManager->getAction();                                                                         
     275               0 :         $actionID = $this->fileManager->getActionID();                                                                     
     276               0 :         $imgFolder = $this->fileManager->getImgFolder();                                                                   
     277                 :                                                                                                                            
     278               0 :         global $visibleIcons;                                                                                              
     279                 :                                                                                                                            
     280               0 :         if (($_SESSION['usergroup'] == STUDENT &&                                                                          
     281               0 :             $this->visibleType != 1 &&                                                                                     
     282               0 :             $_SESSION['userid'] != $this->userID)) {                                                                       
     283                 :             // Wenn Tutor oder Student und darf nicht sehen spezielle DB abfragen                                          
     284               0 :             if (!isset($_SESSION["assistent"]) ||                                                                          
     285               0 :                 (isset($_SESSION["assistent"]) &&                                                                          
     286               0 :                 $this->visibleType == 3 &&                                                                                 
     287               0 :                 $_SESSION['userid'] != $this->userID)) {                                                                   
     288               0 :                 $visible = $db->get_var(                                                                                   
     289                 :                         "SELECT count(*) FROM filevisible WHERE userID='".                                                 
     290               0 :                         $_SESSION['userid']."' AND fileID='".                                                              
     291               0 :                         $this->fileID."'"                                                                                  
     292               0 :                         );                                                                                                 
     293               0 :                 if ($visible < 1) continue;                                                                                
     294               0 :             }                                                                                                              
     295               0 :         }                                                                                                                  
     296               0 :         $cell = $cssClass;                                                                                                 
     297                 :         // Symbole                                                                                                         
     298                 :                                                                                                                            
     299               0 :         global $db;                                                                                                        
     300               0 :         $user = $db->get_row("SELECT Vorname, Nachname, gender FROM user WHERE ID='".$this->userID."'");                   
     301                 :                                                                                                                            
     302                 :         // Username inkl Gruppennamen anzeigen                                                                             
     303               0 :         $courseID = $_SESSION["course"];                                                                                   
     304               0 :         $groupName = UserTools::getUserGroupName($this->userID, $courseID);                                                
     305               0 :         $userName = $user->Vorname . " " . $user->Nachname . " ($groupName)";                                              
     306                 :                                                                                                                            
     307                 :         // Zeigt wenn vorhanden ein Extension basierendes                                                                  
     308                 :         //Icon an (extension.gif/png (einzige mit Transparenz))                                                            
     309                 :         //im Ordner ressourcen/icons/filetypes                                                                             
     310                 :         // BZW Standardfiles fuer Link und Dateien                                                                         
     311               0 :         $fileTypeImage = $imgFolder."filetypes/";                                                                          
     312               0 :         if ($this->type == "link") {                                                                                       
     313               0 :             $fileTypeImage.= "link.gif";                                                                                   
     314                 :             // Prueft ob ein favicon vorhanden ist, und zeigt dann dieses als Symbol an.                                   
     315               0 :             $url = @parse_url($this->link);                                                                                
     316               0 :             if ($url['scheme'] == '') $url['scheme'] = "http";                                                             
     317               0 :             if ($url['host'] != '') {                                                                                      
     318               0 :                 if ($this->remoteFileExists($url['scheme']."://".$url['host']."/favicon.ico")) {                           
     319               0 :                     $fileTypeImage = $url['scheme']."://".$url['host']."/favicon.ico";                                     
     320               0 :                 } elseif ($favicon = $this->getFaviconUrl($url['scheme']."://".$url['host'])) {                            
     321               0 :                     $urlTest = @parse_url($favicon);                                                                       
     322               0 :                     if (isset($urlTest['scheme']) &&                                                                       
     323               0 :                         $urlTest['scheme'] == '') $favicon = $url['scheme'].                                               
     324               0 :                         "://".$url['host'].'/'.$favicon;                                                                   
     325               0 :                     if ($this->remoteFileExists($favicon)) $fileTypeImage = $favicon;                                      
     326               0 :                 }                                                                                                          
     327               0 :             }                                                                                                              
     328               0 :         } elseif ($this->type == "file") {                                                                                 
     329                 :             // erweitert um grossgeschriebene Endungen                                                                     
     330               0 :             if (file_exists($imgFolder."filetypes/".strtolower($this->extension).".gif"))                                  
     331               0 :                 $fileTypeImage.= strtolower($this->extension).".gif";                                                      
     332               0 :             elseif (file_exists($imgFolder."filetypes/".strtolower($this->extension).".png"))                              
     333               0 :                 $fileTypeImage.= strtolower($this->extension).".png";                                                      
     334               0 :             else  {$fileTypeImage.= "file.gif";                                                                            
     335               0 :             $this->extension = "file";}                                                                                    
     336               0 :         }                                                                                                                  
     337               0 :         $img = "<img width='18' height='16' src='".$fileTypeImage."' alt='Dateisymbol' />";                                
     338                 :                                                                                                                            
     339                 :         // Fuer TOP20 wird angezeigt ob Kurs oder Foyer Datei.                                                             
     340               0 :         if ($activeFolder < 0 &&                                                                                           
     341               0 :                 $this->courseID == 0 &&                                                                                    
     342               0 :                 $_SESSION['course'] != 0) $this->name = "".                                                                
     343               0 :                 $this->name."<span class='text10'><strong>&nbsp;&nbsp;(Foyer)</strong></span>";                            
     344                 :                                                                                                                            
     345                 :         //########### Ist Zeile ausgewählt, dann markieren und Hover Effekt unterbinden                                   
     346               0 :         if (isset($_GET['actionID']) && $_GET['actionID'] == $this->fileID) {                                              
     347               0 :             $fileSelect = 'res_fileselect';                                                                                
     348               0 :             $fileClass = '';                                                                                               
     349               0 :         } else {                                                                                                           
     350               0 :             $fileSelect = '';                                                                                              
     351               0 :             $fileClass = 'res_file';                                                                                       
     352                 :         }                                                                                                                  
     353               0 :         $fileName = Data::toHTML($this->name, false);                                                                      
     354                 :                                                                                                                            
     355               0 :         if ($this->type == 'link') {                                                                                       
     356               0 :             $this->size = "Link";                                                                                          
     357               0 :         } else {                                                                                                           
     358               0 :             $this->size = Format::FilesizeStr($this->size);                                                                
     359                 :         }                                                                                                                  
     360                 :                                                                                                                            
     361               0 :         $downloadStats = ($statisticView) ? $this->getDownloadStatisticHTML() : "";                                        
     362               0 :         $link = ($statisticView) ? $this->getStatisticLink() : $this->getFileLink();                                       
     363                 :                                                                                                                            
     364                 :         // Link auf BenutzerProfil                                                                                         
     365                 :         $userLink = "<a href='".                                                                                           
     366               0 :             PATH_TO_ROOT.                                                                                                  
     367               0 :             "user/homepage.php?user=$this->userID'>".                                                                      
     368               0 :             Data::toHTML("$userName", false) ."</a>";                                                                      
     369               0 :         if ($role = RoleArtefacts::getRoleForItem(RESSOURCE, (int)$this->fileID)) {                                        
     370               0 :             $userLink.= " (".$role->getPropertiesLink($role->getName($user->gender)) .")";                                 
     371               0 :         }                                                                                                                  
     372               0 :         if ($team = TeamArtefacts::getTeamForItem(RESSOURCE, (int)$this->fileID)) {                                        
     373               0 :             $userLink.= " (".Data::toHTML($team->getName(), false) .")";                                                   
     374               0 :         }                                                                                                                  
     375               0 :         $tableData = array();                                                                                              
     376               0 :         $tableData["resource"] = $link.$img. $fileName . $downloadStats . "</a>";                                          
     377               0 :         if (!$statisticView)$tableData["action"] = $this->getUserIcons();                                                  
     378               0 :         $tableData["size"] = $this->size;                                                                                  
     379               0 :         $tableData["created"] = Output::echoDate("d.m.Y H:i", (int)$this->createTime);                                     
     380               0 :         $tableData["owner"] = $userLink;                                                                                   
     381               0 :         $tableData["clicks"] = $this->counter;                                                                             
     382                 :                                                                                                                            
     383                 :         //FW % anpassungen ... hier devide by zero wenn course count leer .. also wenn kein curs gewählt                  
     384               0 :         if ($statisticView) {                                                                                              
     385                 :             //userID!=1 => admin rauslassen                                                                                
     386               0 :             $courseCount = $db->get_var(                                                                                   
     387                 :                 "SELECT count(*) FROM user_course ".                                                                       
     388               0 :                 ($this->courseID == 0 ? "" : " WHERE courseID='".$this->courseID."' AND userID!=1")                        
     389               0 :                 );                                                                                                         
     390               0 :             $klicks = $db->get_var(                                                                                        
     391                 :                 "SELECT DISTINCT count(userID) FROM filelog WHERE fileID='".                                               
     392               0 :                 $this->fileID."' AND userID!=1 GROUP BY fileID"                                                            
     393               0 :                 );                                                                                                         
     394                 :                                                                                                                            
     395               0 :             if($courseCount!=0) {                                                                                          
     396                 :                 //nur glatte Prozent beträge                                                                              
     397               0 :                 $prozent = sprintf("%3u%%", ($klicks*100) /$courseCount);                                                  
     398               0 :             }                                                                                                              
     399                 :             else {                                                                                                         
     400                 :                 //0% weil Admin nicht mitgerechnet                                                                         
     401               0 :                 $prozent = "0%";                                                                                           
     402                 :             }                                                                                                              
     403                 :                                                                                                                            
     404                 :             //FW Anzahl Klicks inclusive Admin clicks = nonsense wenn nacher nicht verwendet                               
     405               0 :             $tableData["clicks"] .= "/" . $prozent;                                                                        
     406                 :                                                                                                                            
     407               0 :         }                                                                                                                  
     408                 :                                                                                                                            
     409                 :                                                                                                                            
     410               0 :         $htmlString = "";                                                                                                  
     411               0 :         eval($templateTableRow->getTemplate("htmlString"));                                                                
     412               0 :         if ($actionID == $this->fileID) {                                                                                  
     413               0 :             if ($statisticView) {                                                                                          
     414               0 :                 if ($action == "showInfo") $htmlString .= $this->getStatisticHTML();                                       
     415               0 :             } else {                                                                                                       
     416               0 :                 $htmlString .= $this->getFileOptionHTML($action);                                                          
     417                 :             }                                                                                                              
     418               0 :         }                                                                                                                  
     419                 :                                                                                                                            
     420               0 :         return $htmlString;                                                                                                
     421                 :     }                                                                                                                      
     422                 :                                                                                                                            
     423                 :     public function getFileOptionHTML($option) {                                                                           
     424                 :         switch ($option) {                                                                                                 
     425               0 :             case "deleteFile":                                                                                             
     426               0 :                 return $this->getDeleteFileHTML();                                                                         
     427               0 :             case "copyFile":                                                                                               
     428               0 :                 return $this->getCopyFileHTML();                                                                           
     429               0 :             case "infoFile":                                                                                               
     430               0 :                 return $this->getDescriptionHTML();                                                                        
     431               0 :             case "setRessourceVisibility":                                                                                 
     432                 :                 return  "<tr><td colspan='5'>"                                                                             
     433               0 :                         .$this->getRessourceVisibilityHTML()                                                               
     434               0 :                         ."</td></tr>";                                                                                     
     435                 :         }                                                                                                                  
     436               0 :         return "";                                                                                                         
     437                 :     }                                                                                                                      
     438                 :                                                                                                                            
     439                 :     private function getCopyFileHTML() {                                                                                   
     440               0 :             $template = new Template(PATH_TO_ROOT . "/ressourcen/templates/copyfile.html");                                
     441               0 :             $courses = RessourcenDB::getUserCourses($_SESSION['userid']);                                                  
     442               0 :             $currentCourse = 0;                                                                                            
     443               0 :             $courseOptions = "";                                                                                           
     444               0 :             if ($_SESSION['course'] != 0) {                                                                                
     445               0 :                 $courseOptions .= "<option value='0'>Foyer</option>\n";                                                    
     446               0 :             }                                                                                                              
     447               0 :             foreach($courses as $course) {                                                                                 
     448               0 :                 if ($currentCourse == $course->ID) {                                                                       
     449               0 :                      $courseOptions .= ", ".Data::toHTML($course->ShortName, false);                                       
     450               0 :                 } else {                                                                                                   
     451               0 :                     if ($currentCourse != 0)  $courseOptions .= ")</option>\n";                                            
     452               0 :                     $courseOptions .= "<option value='".$course->ID."'";                                                   
     453               0 :                     $courseOptions .= ">".Data::toHTML($course->SN." (".$course->ShortName, false);                        
     454               0 :                     $currentCourse = $course->ID;                                                                          
     455                 :                 }                                                                                                          
     456               0 :             }                                                                                                              
     457               0 :             $courseOptions .= ")</option>\n";                                                                              
     458               0 :             $folderID = $this->fileManager->getActiveFolder();                                                             
     459               0 :             $fileID = $this->fileID;                                                                                       
     460               0 :             $html = "";                                                                                                    
     461               0 :             eval ($template->getTemplate("html"));                                                                         
     462               0 :             return $html;                                                                                                  
     463                 :     }                                                                                                                      
     464                 :                                                                                                                            
     465                 :     private function getFileLink() {                                                                                       
     466               0 :         if ($this->type == 'file') {                                                                                       
     467                 :             $link = "<a class='file' href='".                                                                              
     468               0 :                 $this->createLink(                                                                                         
     469               0 :                     0, array("activeFolder" => $this->fileManager->getActiveFolder(),                                      
     470               0 :                 "action" => 'get'.$this->type, 'actionID' => $this->fileID)                                                
     471               0 :                     )                                                                                                      
     472               0 :                 ."' title='Dateiname: ".                                                                                   
     473               0 :                 Data::toHTML($this->origFileName, false) ."'>";                                                            
     474               0 :         } elseif ($this->type == 'link') {                                                                                 
     475               0 :             $link = "<a class='file' href='".$this->createLink(                                                            
     476               0 :             0, array("activeFolder" => $this->fileManager->getActiveFolder(),                                              
     477               0 :             "action" => 'get'.$this->type, 'actionID' => $this->fileID)                                                    
     478               0 :             )                                                                                                              
     479               0 :             ."' title='URL: ".                                                                                             
     480               0 :             Data::toHTML($this->link, false) ."'>";                                                                        
     481               0 :         }                                                                                                                  
     482               0 :         return $link;                                                                                                      
     483                 :     }                                                                                                                      
     484                 :                                                                                                                            
     485                 :     private function getStatisticLink() {                                                                                  
     486               0 :         if ($this->type == 'file') {                                                                                       
     487               0 :             $link = "<a class='file' href='".Filemanager::createLink(                                                      
     488               0 :             0,array("activeFolder" => $this->fileManager->getActiveFolder(),                                               
     489               0 :             "action" => 'showInfo', 'actionID' => $this->fileID, 'show' => 'down')                                         
     490               0 :             )                                                                                                              
     491               0 :             ."' title='Dateiname (Studenten heruntergeladen/Gesamt Studenten im Kurs)'>";                                  
     492               0 :         } elseif ($this->type == 'link') {                                                                                 
     493               0 :             $link = "<a class='file' href='".Filemanager::createLink(                                                      
     494               0 :             0,array("activeFolder" => $this->fileManager->getActiveFolder(),                                               
     495               0 :             "action" => 'showInfo', 'actionID' => $this->fileID, 'show' => 'down')                                         
     496               0 :             )                                                                                                              
     497               0 :             ."' title='URL: ".Data::toHTML($this->link, false) ."'>";                                                      
     498               0 :         }                                                                                                                  
     499               0 :         return $link;                                                                                                      
     500                 :     }                                                                                                                      
     501                 :                                                                                                                            
     502                 :     private function getDownloadCount() {                                                                                  
     503               0 :         global $db;                                                                                                        
     504               0 :         if ($this->courseID == 0) {                                                                                        
     505               0 :             $count = (int) $db->get_var(                                                                                   
     506                 :                 "SELECT DISTINCT count(filelog.userID) FROM filelog LEFT JOIN user".                                       
     507               0 :                 " ON (filelog.userID=user.ID) WHERE fileID='".                                                             
     508               0 :                 $this->fileID."' AND filelog.userID!=1 group BY fileID"                                                    
     509               0 :                 );                                                                                                         
     510               0 :         } else {                                                                                                           
     511               0 :             $count = (int) $db->get_var(                                                                                   
     512                 :                 "SELECT DISTINCT count(filelog.userID) FROM filelog LEFT JOIN user_course ON".                             
     513               0 :                 " (filelog.userID=user_course.userID) WHERE fileID='".                                                     
     514               0 :                 $this->fileID."' AND filelog.userID!=1 AND user_course.courseID='".                                        
     515               0 :                 $this->courseID."' group BY fileID"                                                                        
     516               0 :                 );                                                                                                         
     517                 :         }                                                                                                                  
     518               0 :         return $count;                                                                                                     
     519                 :     }                                                                                                                      
     520                 :                                                                                                                            
     521                 :     private function getDownloadStatisticHTML() {                                                                          
     522               0 :         global $db;                                                                                                        
     523               0 :         $downloadCount = $this->getDownloadCount();                                                                        
     524               0 :         if ($this->courseID == 0) {                                                                                        
     525               0 :             $allCount = $db->get_var("SELECT COUNT(*) FROM user WHERE ID!=1");                                             
     526               0 :          } else {                                                                                                          
     527                 :          //TODO: FW file in this ändern !!!                                                                               
     528               0 :            $allCount = $db->get_var(                                                                                       
     529                 :                "SELECT COUNT(*) FROM user_course WHERE courseID='".                                                        
     530               0 :                $this->courseID."' AND userID!=1"                                                                           
     531               0 :                );                                                                                                          
     532                 :          }                                                                                                                 
     533               0 :          return " (".$downloadCount."/".$allCount.")";                                                                     
     534                 :     }                                                                                                                      
     535                 :                                                                                                                            
     536                 :                                                                                                                            
     537                 :     private function getDeleteFileHTML() {                                                                                 
     538               0 :             $template = new Template(PATH_TO_ROOT . "/ressourcen/templates/deletefile.html");                              
     539               0 :             $folderID = $this->fileManager->getActiveFolder();                                                             
     540               0 :             $fileID = $this->fileID;                                                                                       
     541               0 :             $html = "";                                                                                                    
     542               0 :             eval ($template->getTemplate("html"));                                                                         
     543               0 :             return $html;                                                                                                  
     544                 :     }                                                                                                                      
     545                 :                                                                                                                            
     546                 :     private function getDescriptionHTML() {                                                                                
     547               0 :         $bbcode = new BBCode();                                                                                            
     548               0 :         if (!$this->description) $this->description = "Keine Beschreibung vorhanden";                                      
     549                 :         return "<tr><td class='res_file-extra' colspan='6'>".                                                              
     550               0 :             $bbcode->parse($this->description) ."</td></tr>";                                                              
     551                 :     }                                                                                                                      
     552                 :                                                                                                                            
     553                 :     private function getStatisticHTML() {                                                                                  
     554               0 :                 global $db;                                                                                                
     555               0 :                 $cellOne = $cell = 'tableCellDark'; // AnfangsKlasse fuer Tabellenzeile, wechselt                          
     556               0 :                    $cellTwo = 'tableCell';                                                                                 
     557               0 :                    $html = "";                                                                                             
     558                 :                                                                                                                            
     559               0 :                 if ($this->courseID == 0) {                                                                                
     560               0 :                     $allCount = $db->get_var("SELECT COUNT(*) FROM user WHERE ID!=1");                                     
     561               0 :                     $downCount = $db->get_var(                                                                             
     562                 :                         "SELECT DISTINCT count(userID) FROM filelog WHERE fileID='".                                       
     563               0 :                         $this->fileID.                                                                                     
     564                 :                         "' AND userID!=1 GROUP BY fileID"                                                                  
     565               0 :                         );                                                                                                 
     566               0 :                 } else {                                                                                                   
     567               0 :                     $allCount = $db->get_var(                                                                              
     568                 :                         "SELECT COUNT(*) FROM user_course WHERE courseID='".                                               
     569               0 :                         $this->courseID."' AND userID!=1"                                                                  
     570               0 :                         );                                                                                                 
     571               0 :                     $downCount = $db->get_var(                                                                             
     572                 :                     "SELECT DISTINCT count(filelog.userID) FROM filelog ".                                                 
     573               0 :                     "LEFT JOIN user_course ON".                                                                            
     574               0 :                     " (filelog.userID=user_course.userID) WHERE fileID='".$this->fileID.                                   
     575               0 :                     "' AND filelog.userID!=1 AND user_course.courseID='".$this->courseID.                                  
     576                 :                     "' group BY fileID"                                                                                    
     577               0 :                     );                                                                                                     
     578                 :                 }                                                                                                          
     579               0 :                 if ($downCount == "") $downCount = 0;                                                                      
     580               0 :                 $notDownCount = $allCount-$downCount;                                                                      
     581               0 :                 $html .= "<tr><td class='res_file-extra' colspan='5'>";                                                    
     582               0 :                 $html .= "Anzeigen: &nbsp;&nbsp;";                                                                         
     583                 :                                                                                                                            
     584               0 :                 $html .= "[ <a href='".Filemanager::createLink(1, array('show' => 'down')) .                               
     585               0 :                     "'>".($_GET['show'] == 'down' ? "Downloader" : "Downloader") .                                         
     586               0 :                     " (".$downCount.")</a> | ";                                                                            
     587               0 :                 $html .= "<a href='".Filemanager::createLink(1, array('show' => 'notDown')) .                              
     588               0 :                     "'>".($_GET['show'] == 'notDown' ? "Nicht-Downloader" : "Nicht-Downloader") .                          
     589               0 :                     " (".$notDownCount.")</a> ]";                                                                          
     590               0 :                 $html .= "&nbsp;&nbsp;&nbsp;=> Gesamt: ".$allCount;                                                        
     591                 :                 $html .= "<table class='res_statuserlist'><tr><td class='tableCellHead'>Nr.</td>".                         
     592               0 :                     "<td class='tableCellHead' style='text-align: left;'>Person</td><td class='tableCellHead'>Anzahl</td>".
     593               0 :                     "<td class='tableCellHead' style='text-align: right;'>Letzter Zugriff</td></tr>";                      
     594               0 :                 $count = 0;                                                                                                
     595               0 :                 switch ($_GET['show']) { // Was wird angezeigt, down oder not_down                                         
     596                 :                                                                                                                            
     597               0 :                     case 'down': // Zeigt alle User die dieses File Downgeloadet haben                                     
     598               0 :                         $logs = $db->get_results(                                                                          
     599                 :                             "SELECT DISTINCT userID, date, count(userID) AS klicks FROM filelog WHERE fileID='".           
     600               0 :                             $this->fileID.                                                                                 
     601                 :                             "' AND userID!=1 GROUP BY userID ORDER BY userID, date"                                        
     602               0 :                             );                                                                                             
     603               0 :                         if ($logs) foreach($logs as $log) {                                                                
     604               0 :                             $user = $db->get_var(                                                                          
     605                 :                                 "SELECT concat(Nachname,', ',Vorname) AS name FROM user WHERE ID='".                       
     606               0 :                                 $log->userID."'"                                                                           
     607               0 :                             );                                                                                             
     608               0 :                             if (!isset($user)) continue;                                                                   
     609               0 :                             $data[$user][0] = $log->userID;                                                                
     610               0 :                             $data[$user][1] = Data::toHTML($user, false);                                                  
     611               0 :                             $data[$user][2] = $log->date;                                                                  
     612               0 :                             $data[$user][3] = $log->klicks;                                                                
     613               0 :                         }                                                                                                  
     614               0 :                         if (!empty($data)) {                                                                               
     615               0 :                             ksort($data); // Array wird nach UserName sortiert                                             
     616               0 :                             foreach($data as $value) { //Gibt Namensliste aus                                              
     617               0 :                                 $cell = ($cell == $cellOne ? $cellTwo : $cellOne);                                         
     618               0 :                                 $userLink = PATH_TO_ROOT."user/homepage.php?user=".$value[0];                              
     619               0 :                                 $html .= "<tr><td class='$cell'>".++$count.                                                
     620               0 :                                     "</td><td class='$cell' style='text-align: left;'><a href='$userLink'>"                
     621               0 :                                     .$value[1]."</a></td><td class='$cell' >"                                              
     622               0 :                                     .$value[3]."</td><td class='$cell' style='text-align: right;'>".                       
     623               0 :                                     Date("d.m.Y H:i", (int)$value[2]) ."</td></tr>";                                       
     624               0 :                             }                                                                                              
     625               0 :                         }                                                                                                  
     626               0 :                         break;                                                                                             
     627                 :                                                                                                                            
     628               0 :                     case 'notDown': // Alle user die es nicht downgeloadet haben                                           
     629               0 :                         if ($this->courseID == 0) {                                                                        
     630               0 :                             $users = $db->get_results(                                                                     
     631                 :                                 "SELECT ID, concat(Nachname,', ',Vorname) AS name FROM user ".                             
     632                 :                                 "WHERE ID!=1 ORDER BY name"                                                                
     633               0 :                             );                                                                                             
     634               0 :                         } else {                                                                                           
     635               0 :                             $users = $db->get_results(                                                                     
     636                 :                                 "SELECT ID, concat(Nachname,', ',Vorname) AS name FROM user_course".                       
     637               0 :                                 " LEFT OUTER JOIN user ON (user_course.userID=user.ID) ".                                  
     638               0 :                                 "WHERE ID!=1 AND user_course.courseID='".                                                  
     639               0 :                                 $this->courseID."' ORDER BY name"                                                          
     640               0 :                             );                                                                                             
     641                 :                         }                                                                                                  
     642               0 :                         if ($users) foreach($users as $user) {                                                             
     643               0 :                             $userLink = PATH_TO_ROOT."user/homepage.php?user=".$user->ID;                                  
     644               0 :                             $log = $db->get_var(                                                                           
     645                 :                                 "SELECT DISTINCT count(filelog.userID) AS klicks FROM filelog ".                           
     646               0 :                                 "LEFT JOIN user_course ON (filelog.userID=user_course.userID)  ".                          
     647               0 :                                 "WHERE filelog.userID='".$user->ID."' AND fileID='".                                       
     648               0 :                                 $this->fileID.                                                                             
     649                 :                                 "' GROUP BY filelog.userID"                                                                
     650               0 :                             );                                                                                             
     651               0 :                             if ($log != 0) continue;                                                                       
     652               0 :                             $cell = ($cell == $cellOne ? $cellTwo : $cellOne);                                             
     653               0 :                             $html .= "<tr><td class='$cell'>".++$count.                                                    
     654               0 :                                 "</td><td class='$cell' style='text-align: left;'><a href='$userLink'>".                   
     655               0 :                                 Data::toHTML($user->name, false) .                                                         
     656               0 :                                 "</a></td><td class='$cell' >0</td><td class='$cell'".                                     
     657               0 :                                 " style='text-align: right;'>Nie</td></tr>";                                               
     658               0 :                         }                                                                                                  
     659               0 :                         break;                                                                                             
     660                 :                                                                                                                            
     661               0 :                     case 'all': // Zeige ALLE User des Kurses an... ZZT DEAKTIVIERT                                        
     662               0 :                         if ($this->courseID == 0) {                                                                        
     663               0 :                             $users = $db->get_results(                                                                     
     664                 :                             "SELECT ID, concat(Vorname,' ',Nachname) AS name FROM user ORDER BY name"                      
     665               0 :                             );                                                                                             
     666               0 :                         } else {                                                                                           
     667               0 :                             $users = $db->get_results(                                                                     
     668                 :                                 "SELECT ID, concat(Vorname,' ',Nachname) AS name FROM user_course ".                       
     669               0 :                                 "LEFT OUTER JOIN user ON (user_course.userID=user.ID) ".                                   
     670                 :                                 "WHERE user_course.courseID='"                                                             
     671               0 :                                 .$this->courseID."' ORDER BY name"                                                         
     672               0 :                             );                                                                                             
     673                 :                         }                                                                                                  
     674               0 :                         if ($users) foreach($users as $user) {                                                             
     675               0 :                             $cell = ($cell == $cellOne ? $cellTwo : $cellOne);                                             
     676               0 :                             $userLink = PATH_TO_ROOT."user/homepage.php?user=".$user->ID;                                  
     677               0 :                             $log = $db->get_row(                                                                           
     678                 :                                     "SELECT DISTINCT count(userID) AS klicks, date FROM filelog WHERE userID='".           
     679               0 :                                     $user->ID."' AND fileID='".$this->fileID."' GROUP BY userID"                           
     680               0 :                                     );                                                                                     
     681               0 :                             $date = Output::$html .=Date("d.m.Y H:i", (int)$log->date);                                    
     682               0 :                             if ($log->date == 0) $date = "Nie";                                                            
     683               0 :                             if ($log->klicks == 0) $log->klicks = "0";                                                     
     684               0 :                             $html .= "<tr><td class='$cell' >".++$count.                                                   
     685               0 :                                     "</td><td class='$cell' ><a href='$userLink'>".                                        
     686               0 :                                     Data::toHTML($user->name, false) ."</a></td><td class='$cell' >".                      
     687               0 :                                     $log->klicks."</td><td class='$cell'  style='font-size:10px;text-align:right;' >".     
     688               0 :                                     $date."</td></tr>";                                                                    
     689               0 :                         }                                                                                                  
     690               0 :                         break;                                                                                             
     691               0 :                     }                                                                                                      
     692               0 :                     $html .= "</table></td></tr>";                                                                         
     693               0 :                     return $html;                                                                                          
     694                 :                                                                                                                            
     695                 :     }                                                                                                                      
     696                 :                                                                                                                            
     697                 :     /**                                                                                                                    
     698                 :      * Archiver accept method for ArchiveVisitor                                                                           
     699                 :      *                                                                                                                     
     700                 :      * @param ArchiveVisitor $visitor                                                                                      
     701                 :      * @param String $parentPath Parent path                                                                               
     702                 :      * @return Sting Parent path                                                                                           
     703                 :      */                                                                                                                    
     704                 :     public function archiverAccept(ResourceVisitor $visitor, $parentPath = "/") {                                          
     705               0 :         assert($visitor instanceof ResourceVisitor);                                                                       
     706                 :                                                                                                                            
     707               0 :         return $visitor->visit($this, $parentPath);                                                                        
     708                 :     }                                                                                                                      
     709                 : }                                                                                                                          

Generated by PHPUnit 3.2.21 and Xdebug 2.0.3 at Thu Nov 26 17:01:15 CET 2009.